/*
package com.thread.threadfirst.rabbitMQPublisher.consumer;

import com.alibaba.fastjson.JSONObject;
import com.rabbitmq.client.Channel;
import com.thread.threadfirst.rabbitMQPublisher.constant.AMQPConstant;
import com.thread.threadfirst.rabbitMQPublisher.vo.RegisterVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Map;

*/
/**
 * 死信队列消费者
 *//*

@Component
@Slf4j
public class ConsumerDL {

    @RabbitListener(queues = AMQPConstant.REDIRECT_QUEUE,containerFactory = "singleListenerContainer")
    public void listerDL(Message message, Channel channel, @Header(name = "amqp_deliveryTag") long deliveryTag,
                         @Header(name = "amqp_redelivered") boolean redelivered,@Headers Map<String,String> headers){
        try {
            String messageContent=new String(message.getBody(),"utf-8");
            RegisterVO vo=JSONObject.parseObject(messageContent, RegisterVO.class);
            log.info("singleListenerContainer receive message:{},headers:{}",vo.toString(),headers);
            channel.basicAck(deliveryTag,true);
        } catch (Exception e) {
            log.error("consumer confirm error! {}",e.getMessage());
            try {
                channel.basicReject(deliveryTag,true);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
}
*/
